<?php

function buildTreeCategoryOption($catData, $prentsID = 0) {
    $specs = '&nbsp;';
    foreach ($catData as $aCat) {

        if ($aCat['category_parent'] == $prentsID) {
            if($aCat['category_level'] == 0){
                $style = 'style=color:#F58516;';
            }
            if ($aCat['category_level'] == 1) {
                $specs = '&nbsp;&nbsp;&nbsp;';
            }
            if ($aCat['category_level'] == 2) {
                $specs = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
            }
            if ($aCat['category_level'] == 3) {
                $specs = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
            }
            $catList .= "<option value=" . $aCat['category_id'] . "  $style>" . $specs . $aCat['category_name'] . "</option>";
            $catList .= buildTreeCategoryOption($catData, $aCat['category_id']);
        }
    }
    return $catList;
}
$strCatOption = buildTreeCategoryOption($aryCategory);
?>
<div style="height: 1px;clear: both;"></div>
<div class="search_product">
    <form name="frmSearchProductOrder" id="frmSearchProductOrder" onsubmit="AdminController.searchProductOrder(); return false;">
        <ul class="list_item_search">
            <li>
                Tên hoặc mã sản phẩm
            </li>
            <li>
                <input type="text" name="search_product_order_name" id="search_product_order_name" class="w300p">
            <li>
            <li>
                <select name="search_product_category_id" id="search_product_category_id">
                    <option value="0">Chọn danh mục</option>
                    <?php echo $strCatOption; ?>
                </select>
            </li>
                <input type="submit" name="btn_search_product_order" id="btn_search_product_order" class="submit" value="Tìm kiếm">
            </li>
        </ul>
    </form>
</div>
<div id="searchProductOrderRestult">
    
</div>
